from volcenginesdkarkruntime import Ark

client = Ark(
    base_url="https://ark.cn-beijing.volces.com/api/v3",
    ak="AKLTMzYzNTFmMjBmOGQ5NDRiODhiMjExNzM2ZjJiMjIxYWQ",
    sk="TURsaFpqTTVNek00WldWak5HTm1Namd5WXpVeE16azBNVGRrWW1NM01Eaw==",
    api_key="c973941c-1508-4712-b98a-fdb07ffeb2bc",
)

websites =['https://finance.yahoo.com/news/dan-ives-says-apple-aapl-135134126.html?.tsrc=rss', 'https://finance.yahoo.com/news/investors-continued-discount-apple-aapl-120706966.html?.tsrc=rss', 'https://finance.yahoo.com/news/apple-hires-400-workers-retail-074120429.html?.tsrc=rss', 'https://finance.yahoo.com/news/apple-inc-aapl-bull-case-014504133.html?.tsrc=rss', 'https://www.yahoo.com/tech/apple-stock-slips-big-cut-212000986.html?.tsrc=rss']
# Streaming:
print("----- streaming request -----")
stream = client.chat.completions.create(
    model="ep-20241024223706-wnd4l",
    messages=[
        {"role": "user", "content": f"总结与分析给出结论：{websites}"},
    ],
    stream=True
)
for chunk in stream:
    if not chunk.choices:
        continue
    print(chunk.choices[0].delta.content, end="")
print()
